package com.mt.shop.mapper;

import com.mt.shop.domain.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface UserDao {

    //添加
    @Insert("INSERT INTO user(username,password) value(#{username},#{password})")
    void add(String username,String password);
    //删除
    @Delete("DELETE FROM user WHERE userid=#{userid}")
    void del(Long userid);
    //修改
    @Update("UPDATE user SET username=#{username} WHERE userid=#{userid}")
    void upd(User user);
    //按id查询
    @Select("SELECT * FROM user where userid=#{userid}")
    User getUserById(Long userid);
    //查询所有
    @Select("SELECT * FROM user")
    List<User> getAll();

}
